from __future__ import division
import time
import Adafruit_PCA9685


pwm = Adafruit_PCA9685.PCA9685()


# Configure min and max servo pulse lengths
servo_min = 10  # Min pulse length out of 4096
servo_max = 800  # Max pulse length out of 4096

# Set frequency to 60hz, good for servos.
pwm.set_pwm_freq(60)

# Move servo on channel O between extremes.
while True:
    command = input("Please input 0 or 1:")
    if str(command) == '1':
        pwm.set_pwm(0, 0, servo_min)
        time.sleep(0.02)
        pwm.set_pwm(0,0,0)
    elif str(command) == '2':
        pwm.set_pwm(0, 0, servo_max)
        time.sleep(0.03)
        pwm.set_pwm(0,0,0)

    elif str(command) == '3':
        pwm.set_pwm(1, 0, servo_min)
        time.sleep(0.02)
        pwm.set_pwm(1,0,0)

    elif str(command) == '4':
        pwm.set_pwm(1, 0, servo_max)
        time.sleep(0.03)
        pwm.set_pwm(1,0,0)
